<%@ include file="CheckLogin.jsp"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel='stylesheet' type='text/css' href='css/index.css' />
<link rel='stylesheet' type='text/css' href='css/style.css' />
<link rel='stylesheet' type='text/css' href='css/thread.css' />
<link rel='stylesheet' type='text/css' href='css/menu.css' />
<link rel='stylesheet' type='text/css' href='css/footer.css' />
<title>Trang chủ - HiRoom!</title>
</head>
<body>
	<%@ include file="Header.jsp"%>

	<div id='wrapper'>
		<!--separator-->
		<div class='separator'>
			<h2>TOP 5 bài mới</h2>
		</div>

		<c:forEach var="thread" items="${newThread}">
			<div class='new_thread'>
				<h4>
					<a href="thread?do=view&tid=${thread.id}">${thread.title}</a>
				</h4>
				<div>
					<span>bởi </span><a href='account?do=view&uid=${thread.account.id}'>${thread.account.username}</a><span>
						trả lời: ${thread.reply} - xem: ${thread.see}</span>
					<c:choose>
						<c:when test="${account.type=='Admin'}">
							<a href='thread?do=del&tid=${thread.id}&bid=${thread.boxID}'
								title='Xóa' class='nof'><img src='images/delete.png'
								alt='Delete' /> </a>
							<a
								href='thread?do=setting&action=hide&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==3||thread.state==4?"Bỏ ẩn":"Ẩn"}'
								class='nof'><img
								src='images/${thread.state==3||thread.state==4?"show":"hide"}.png'
								alt='${thread.state==3||thread.state==4?"Show":"Hide"}' /> </a>
							<a
								href='thread?do=setting&action=close&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==-1||thread.state==2||thread.state==4?"Mở chủ đề":"Đóng chủ đề"}'
								class='nof'><img
								src='images/${thread.state==-1||thread.state==2||thread.state==4?"open":"close"}.png'
								alt='${thread.state==-1||thread.state==2||thread.state==4?"Open":"Close"}' />
							</a>
							<a
								href='thread?do=setting&action=caution&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==1||thread.state==2?"Gỡ chú ý":"Chú ý"}'
								class='nof'><img
								src='images/${thread.state==1||thread.state==2?"caution_sub":"caution_add"}.png'
								alt='${thread.state==1||thread.state==2?"Not Caution":"Caution"}' />
							</a>
						</c:when>
						<c:when test="${account.type=='SMod'}">
							<a
								href='thread?do=setting&action=hide&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==3||thread.state==4?"Bỏ ẩn":"Ẩn"}'
								class='nof'><img
								src='images/${thread.state==3||thread.state==4?"show":"hide"}.png'
								alt='${thread.state==3||thread.state==4?"Show":"Hide"}' /> </a>
							<a
								href='thread?do=setting&action=close&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==-1||thread.state==2||thread.state==4?"Mở chủ đề":"Đóng chủ đề"}'
								class='nof'><img
								src='images/${thread.state==-1||thread.state==2||thread.state==4?"open":"close"}.png'
								alt='${thread.state==-1||thread.state==2||thread.state==4?"Open":"Close"}' />
							</a>
							<a
								href='thread?do=setting&action=caution&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==1||thread.state==2?"Gỡ chú ý":"Chú ý"}'
								class='nof'><img
								src='images/${thread.state==1||thread.state==2?"caution_sub":"caution_add"}.png'
								alt='${thread.state==1||thread.state==2?"Not Caution":"Caution"}' />
							</a>
						</c:when>
						<c:when test="${account.type=='Mod'}">
							<a
								href='thread?do=setting&action=hide&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==3||thread.state==4?"Bỏ ẩn":"Ẩn"}'
								class='nof'><img
								src='images/${thread.state==3||thread.state==4?"show":"hide"}.png'
								alt='${thread.state==3||thread.state==4?"Show":"Hide"}' /> </a>
							<a
								href='thread?do=setting&action=close&tid=${thread.id}&bid=${thread.boxID}'
								title='${thread.state==-1||thread.state==2||thread.state==4?"Mở chủ đề":"Đóng chủ đề"}'
								class='nof'><img
								src='images/${thread.state==-1||thread.state==2||thread.state==4?"open":"close"}.png'
								alt='${thread.state==-1||thread.state==2||thread.state==4?"Open":"Close"}' />
							</a>
						</c:when>
					</c:choose>
				</div>
			</div>
		</c:forEach>

		<div class='separator'>
			<h2>Các chuyên mục</h2>
		</div>

		<c:forEach var="box" items="${boxs}">
			<div class='box'>
				<h3>
					<a href="thread?do=list&bid=${box.id}">${box.title}</a>
				</h3>
				<p>${box.description}</p>

				<c:forEach var="thread" items="${box.threads}">
					<h4>
						<a href="thread?do=view&tid=${thread.id}">${thread.title}</a>
					</h4>
				</c:forEach>
			</div>
		</c:forEach>

	</div>

	<jsp:include page="Footer.jsp"></jsp:include>
	<!-- <script type="text/javascript">
		document
				.write('<style type="text/css">body{padding-bottom:20px}</style><div style="position:fixed;z-index:9999;bottom:-50px;left:0;width:100%;height:104px;"></div>');
		var no = 100;
		var hidesnowtime = 0;
		var snowdistance = 'pageheight';
		var ie4up = (document.all) ? 1 : 0;
		var ns6up = (document.getElementById && !document.all) ? 1 : 0;
		function iecompattest() {
			return (document.compatMode && document.compatMode != 'BackCompat') ? document.documentElement
					: document.body
		}
		var dx, xp, yp;
		var am, stx, sty;
		var i, doc_width = 800, doc_height = 600;
		if (ns6up) {
			doc_width = self.innerWidth;
			doc_height = self.innerHeight
		} else if (ie4up) {
			doc_width = iecompattest().clientWidth;
			doc_height = iecompattest().clientHeight
		}
		dx = new Array();
		xp = new Array();
		yp = new Array();
		am = new Array();
		stx = new Array();
		sty = new Array();
		for (i = 0; i < no; ++i) {
			dx[i] = 0;
			xp[i] = Math.random() * (doc_width - 50);
			yp[i] = Math.random() * doc_height;
			am[i] = Math.random() * 20;
			stx[i] = 0.02 + Math.random() / 10;
			sty[i] = 0.7 + Math.random();
			if (ie4up || ns6up) {
				document
						.write('<div id="dot'+i+'" style="POSITION:absolute;Z-INDEX:'+i+';VISIBILITY:visible;TOP:15px;LEFT:15px;"><span style="font-size:18px;color:#fff">*</span><\/div>')
			}
		}
		function snowIE_NS6() {
			doc_width = ns6up ? window.innerWidth - 10
					: iecompattest().clientWidth - 10;
			doc_height = (window.innerHeight && snowdistance == 'windowheight') ? window.innerHeight
					: (ie4up && snowdistance == 'windowheight') ? iecompattest().clientHeight
							: (ie4up && !window.opera && snowdistance == 'pageheight') ? iecompattest().scrollHeight
									: iecompattest().offsetHeight;
			for (i = 0; i < no; ++i) {
				yp[i] += sty[i];
				if (yp[i] > doc_height - 50) {
					xp[i] = Math.random() * (doc_width - am[i] - 30);
					yp[i] = 0;
					stx[i] = 0.02 + Math.random() / 10;
					sty[i] = 0.7 + Math.random()
				}
				dx[i] += stx[i];
				document.getElementById('dot' + i).style.top = yp[i] + 'px';
				document.getElementById('dot' + i).style.left = xp[i] + am[i]
						* Math.sin(dx[i]) + 'px'
			}
			snowtimer = setTimeout('snowIE_NS6()', 10)
		}
		function hidesnow() {
			if (window.snowtimer) {
				clearTimeout(snowtimer)
			}
			for (i = 0; i < no; i++)
				document.getElementById('dot' + i).style.visibility = 'hidden'
		}
		if (ie4up || ns6up) {
			snowIE_NS6();
			if (hidesnowtime > 0)
				setTimeout('hidesnow()', hidesnowtime * 1000)
		}
	</script> -->
</body>
</html>